# -*- coding: utf-8 -*-
"""
@author: wyb
@date: 2023/12/15
@time: 21:02
@desc: Displays the mouse cursor's current position
"""
import pyautogui, time

print('Press Ctrl-C to quit.')
time.sleep(2)
# pyautogui.doubleClick((945,194))
try:
    while True:
        x, y = pyautogui.position()
        postionstr = 'X:' + str(x).rjust(4) + " Y:" + str(y).rjust(4)
        pixelColor = pyautogui.screenshot().getpixel((x, y))
        postionstr += ' RGB: (' + str(pixelColor[0]).rjust(3)
        postionstr += ',' + str(pixelColor[1]).rjust(3)
        postionstr += ',' + str(pixelColor[2]).rjust(3) + ')'
        print(postionstr, end='')
        time.sleep(0.3)
        print('\b' * len(postionstr), end='', flush=True)
        # time.sleep(0.1)
except KeyboardInterrupt:
    print('\nDone.')
